$INCLUDE: 'C:\FG\FASTGRAF.FI'

      PROGRAM MAIN

      INTEGER NEW_MODE, OLD_MODE
      INTEGER STATUS
      INTEGER FG_ALLOCATE, FG_BESTMODE, FG_FREEPAGE, FG_GETMODE

      NEW_MODE = FG_BESTMODE(320,200,2)
      IF (NEW_MODE .LT. 0 .OR. NEW_MODE .EQ. 12) THEN
         STOP 'This program requires a 320 x 200 color graphics mode.'
      END IF
      OLD_MODE = FG_GETMODE()
      CALL FG_SETMODE(NEW_MODE)
      STATUS = FG_ALLOCATE(1)
      CALL FG_SETHPAGE(1)

      CALL FG_SETCOLOR(2)
      CALL FG_RECT(0,319,0,199)
      CALL FG_SETPAGE(1)
      CALL FG_SETCOLOR(1)
      CALL FG_RECT(0,319,0,199)
      CALL FG_WAITKEY

      CALL FG_FADEIN(0)
      CALL FG_WAITKEY

      STATUS = FG_FREEPAGE(1)
      CALL FG_SETMODE(OLD_MODE)
      CALL FG_RESET

      STOP ' '
      END
